<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="cnt">
			<div id="d1" style="width:100px;height:2000px;background-color: red; "></div>
		</div>
		<div id="loading" style="text-align: center;display: none;">
			<img src="images/loading2.gif" />
		</div>
	</body>
		<script>
			var i=1;
			window.onscroll=function(){
				var x=document.documentElement.scrollHeight;
				var y=document.documentElement.scrollTop;;
				var z=document.documentElement.clientHeight;
				
		
				console.log(x+" "+y+" "+z);
				
	
			if(y+z==x){
				if(i==4){
				loading.style.display="block";
				loading.innerHTML="--我是有底线的--";
				return;
			}
			if(loading.style.display="none"){
				loading.style.display="block";
				setTimeout(function(){
					var newNode=document.createElement("div");
					i++;
					newNode.innerHTML=i;
					newNode.style.height="1000px";
					newNode.style.width="200px";
					newNode.style.background="pink";
					newNode.style["margin-top"]="10px";
					cnt.appendChild(newNode);
					loading.style.display="none";
					
				},300)
			}
				
			}
			}
		</script>
	
</html>
